import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ItemVO, ItemForm, ItemQuery } from '@/api/nft/item/types';

/**
 * 查询nft列表
 * @param query
 * @returns {*}
 */

export const listItem = (query?: ItemQuery): AxiosPromise<ItemVO[]> => {
  return request({
    url: '/nft/item/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询nft详细
 * @param id
 */
export const getItem = (id: string | number): AxiosPromise<ItemVO> => {
  return request({
    url: '/nft/item/' + id,
    method: 'get'
  });
};

/**
 * 新增nft
 * @param data
 */
export const addItem = (data: ItemForm) => {
  return request({
    url: '/nft/item',
    method: 'post',
    data: data
  });
};

/**
 * 修改nft
 * @param data
 */
export const updateItem = (data: ItemForm) => {
  return request({
    url: '/nft/item',
    method: 'put',
    data: data
  });
};

/**
 * 删除nft
 * @param id
 */
export const delItem = (id: string | number | Array<string | number>) => {
  return request({
    url: '/nft/item/' + id,
    method: 'delete'
  });
};
